home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 123_01.zip / TR.DOC < prev    next >
Text File  |  1993-06-07  |  3KB  |  137 lines

  1. .bp 1
  2. .in 0
  3. .he 'TR (1)'02/22/83'TR (1)'
  4. .fo ''-#-''
  5. .fi
  6. .in 7
  7. .ti -7
  8. NAME
  9. .br
  10. tr - character transliteration
  11. .sp 1
  12. .ti -7
  13. SYNOPSIS
  14. .br
  15. tr <infile [>outfile] from [to]
  16. .sp 1
  17. .ti -7
  18. DESCRIPTION
  19. .br
  20. "TR" copies the standard input to the standard output with
  21. substitution or deletion of selected characters.  Input
  22. characters found in "FROM" are mapped into the corresponding
  23. characters of "TO".
  24. Ranges of characters may be specified by separating
  25. the extremes by a dash.
  26. For example, a-z stands for the string of characters whose ascii
  27. codes run from character a through character z.
  28.  
  29. Strings require "escape" sequences for:
  30.  
  31. .nf
  32. blank: \b    newline: \n    tab: \t
  33. return: \r    backslash: \\    octal code: \nnn
  34. lower case: \l    upper case: \u
  35. .br
  36. .fi
  37.  
  38. These last two are necesary under CP/M because it makes
  39. command lines upper case before the program gets to it.
  40. Lower case is assumed at the beginning of both
  41. the <from_string> and <to_string>.
  42. It remains in whatever case was given last until another
  43. \l or \u is given OR to the end of the string.
  44.  
  45. If the number of characters
  46. in "FROM" is the same as in "TO", a one to one corresponding
  47. translation will be performed on all occurrences of the characters
  48. in "FROM".
  49. If the number of characters in "FROM" is more than in "TO", the
  50. implication is that the last character in the "TO" string is
  51. to be replicated as often as necessary to make a string as long
  52. as the "FROM" string, and that this replicated character should
  53. be collapsed into only one.  If the "TO" string is missing or
  54. empty, "TR" will take this condition as a request to delete
  55. all occurrences of characters in the "FROM" string.
  56. .sp 1
  57. "TR" differs from the tool "CH" since it deals only with
  58. single characters or ranges of characters, while "CH" deals
  59. with character strings.  For example  tr xy yx  would change
  60. all x's into y's and all y's into x's, whereas ch xy yx
  61. change all the patterns "xy" into "yx".
  62. .sp 1
  63. One of the most common functions of "TR" is to translate
  64. upper case letters to lower case, and vice versa.  Thus,
  65.  
  66. .ce
  67. tr \ua-z a-z
  68.  
  69. would map all upper case letters to lower
  70. case.
  71. .sp 1
  72. .ti -7
  73. FILES
  74. .br
  75. None
  76. .sp 1
  77. .ti -7
  78. SEE ALSO
  79. .br
  80. .nf
  81. dio
  82. find, ch, edit, sedit
  83. The "Software Tools" book, p. 51-61.
  84. The "UNIX Programmer's Manual", p. TR(I).
  85. .fi
  86. .sp 1
  87. .ti -7
  88. DIAGNOSTICS
  89. .br
  90. "usage: <infile [>outfile] tr from [to]"
  91. .br
  92. .in +5
  93. The command line passed to transit is in error.
  94. .br
  95. .in -5
  96. "<from> too large."
  97. .br
  98. .in +5
  99. The string for "from" is too large.  Current limit is 129 characters
  100. including E0S.
  101. .br
  102. .in -5
  103. "<to> too large."
  104. .br
  105. .in +5
  106. The string for "to" is too large.  Current limit is 129 characters
  107. including EOS.
  108. .sp 1
  109. .in -5
  110. .ti -7
  111. AUTHORS
  112. .br
  113. Original code from Kernighan and Plauger's "Software Tools",
  114. with minor modifications by Debbie Scherrer.
  115. Transliterated from RATFOR to BDS C by Robert T. Pasky.
  116. Calls to dio added by Edward K. Ream.
  117. .sp 1
  118. .ti -7
  119. BUGS/DEFICIENCIES
  120. .br
  121. None
  122. .sp 1
  123. .ti -7
  124. NOTES
  125. .br
  126. Link "TR" to the dio package as follows:
  127. .sp 1
  128. .ce
  129. clink tr -f dio
  130. UGS/DEFICIENCIES
  131. .br
  132. None
  133. .sp 1
  134. .ti -7
  135. NOTES
  136. .br
  137. Link "TR"